﻿using System.ComponentModel;
using Loki.Game;
using Loki.Utilities;

namespace FlaskHelper
{
    public class FlaskHelperSettings : JsonSettings
    {

        private static FlaskHelperSettings _instance;

        /// <summary>The current instance for this class. </summary>
        public static FlaskHelperSettings Instance
        {
            get { return _instance ?? (_instance = new FlaskHelperSettings()); }
        }

        /// <summary>The default ctor. Will use the settings path "FlaskHelper".</summary>
        public FlaskHelperSettings()
            : base(GetSettingsFilePath(@"Plugins\FlaskHelper", string.Format("{0} - {1}.json", LokiPoe.ObjectManager.Me.League, LokiPoe.ObjectManager.Me.Name)))
        {

        }

        #region FlaskSettings

        private float _lifeFlaskThreshold;
        private float _manaFlaskThreshold;

        private bool _useGraniteFlask;
        private float _graniteFlaskThreshold;

        private bool _useJadeFlask;
        private float _jadeFlaskThreshold;

        private bool _useRubyFlask;
        private float _rubyFlaskThreshold;

        private bool _useDiamondFlask;
        private float _diamondFlaskThreshold;

        private bool _useBleedingFlask;
        private float _bleedingFlaskThreshold;

        private bool _useShockFlask;
        private float _shockFlaskThreshold;

        private bool _useBurningFlask;
        private float _burningFlaskThreshold;

        private bool _useFrozenFlask;
        private float _frozenFlaskThreshold;

        private bool _useDivinationFlask;
        private float _divinationFlaskThreshold;

        private bool _useEnergyShieldForThresholds;

        #endregion

        #region Settings Get/Set

            #region Common Flasks

            /// <summary>Get / Set Threshold for Life Flask</summary>
            [DefaultValue(75)]
            public float LifeFlaskThreshold
            {
                get { return _lifeFlaskThreshold; }
                set
                {
                    if (value.Equals(_lifeFlaskThreshold))
                    {
                        return;
                    }
                    _lifeFlaskThreshold = value;
                    NotifyPropertyChanged(() => LifeFlaskThreshold);
                }
            }

            /// <summary>Get / Set Threshold for Mana Flask</summary>
            [DefaultValue(50)]
            public float ManaFlaskThreshold
            {
                get { return _manaFlaskThreshold; }
                set
                {
                    if (value.Equals(_manaFlaskThreshold))
                    {
                        return;
                    }
                    _manaFlaskThreshold = value;
                    NotifyPropertyChanged(() => ManaFlaskThreshold);
                }
            }

            #endregion

            #region Special Flasks

            /// <summary>Get / Set Enable Granite Flask</summary>
            [DefaultValue(false)]
            public bool UseGraniteFlask
            {
                get { return _useGraniteFlask; }
                set
                {
                    _useGraniteFlask = value;
                    NotifyPropertyChanged(() => UseGraniteFlask);
                }
            }

            /// <summary>Get / Set Granite Flask Threshold</summary>
            [DefaultValue(0)]
            public float GraniteFlaskThreshold
            {
                get { return _graniteFlaskThreshold; }
                set
                {
                    _graniteFlaskThreshold = value;
                    NotifyPropertyChanged(() => GraniteFlaskThreshold);
                }
            }

            /// <summary>Get / Set Enable Jade Flask</summary>
            [DefaultValue(false)]
            public bool UseJadeFlask
            {
                get { return _useJadeFlask; }
                set
                {
                    _useJadeFlask = value;
                    NotifyPropertyChanged(() => UseJadeFlask);
                }
            }

            /// <summary>Get / Set Jade Flask Threshold</summary>
            [DefaultValue(0)]
            public float JadeFlaskThreshold
            {
                get { return _jadeFlaskThreshold; }
                set
                {
                    _jadeFlaskThreshold = value;
                    NotifyPropertyChanged(() => JadeFlaskThreshold);
                }
            }

            /// <summary>Get / Set Enable Ruby Flask</summary>
            [DefaultValue(false)]
            public bool UseRubyFlask
            {
                get { return _useRubyFlask; }
                set
                {
                    _useRubyFlask = value;
                    NotifyPropertyChanged(() => UseRubyFlask);
                }
            }

            /// <summary>Get / Set Granite Ruby Threshold</summary>
            [DefaultValue(0)]
            public float RubyFlaskThreshold
            {
                get { return _rubyFlaskThreshold; }
                set
                {
                    _rubyFlaskThreshold = value;
                    NotifyPropertyChanged(() => RubyFlaskThreshold);
                }
            }

            /// <summary>Get / Set Enable Diamond Flask</summary>
            [DefaultValue(false)]
            public bool UseDiamondFlask
            {
                get { return _useDiamondFlask; }
                set
                {
                    _useDiamondFlask = value;
                    NotifyPropertyChanged(() => UseDiamondFlask);
                }
            }

            /// <summary>Get / Set Diamond Flask Threshold</summary>
            [DefaultValue(0)]
            public float DiamondFlaskThreshold
            {
                get { return _diamondFlaskThreshold; }
                set
                {
                    _diamondFlaskThreshold = value;
                    NotifyPropertyChanged(() => DiamondFlaskThreshold);
                }
            }

            /// <summary>Get / Set Enable Bleeding Flask</summary>
            [DefaultValue(false)]
            public bool UseBleedingFlask
            {
                get { return _useBleedingFlask; }
                set
                {
                    _useBleedingFlask = value;
                    NotifyPropertyChanged(() => UseBleedingFlask);
                }
            }

            /// <summary>Get / Set Bleeding Flask Threshold</summary>
            [DefaultValue(0)]
            public float BleedingFlaskThreshold
            {
                get { return _bleedingFlaskThreshold; }
                set
                {
                    _bleedingFlaskThreshold = value;
                    NotifyPropertyChanged(() => BleedingFlaskThreshold);
                }
            }

            /// <summary>Get / Set Enable Shock Flask</summary>
            [DefaultValue(false)]
            public bool UseShockFlask
            {
                get { return _useShockFlask; }
                set
                {
                    _useShockFlask = value;
                    NotifyPropertyChanged(() => UseShockFlask);
                }
            }

            /// <summary>Get / Set Shock Flask Threshold</summary>
            [DefaultValue(0)]
            public float ShockFlaskThreshold
            {
                get { return _shockFlaskThreshold; }
                set
                {
                    _shockFlaskThreshold = value;
                    NotifyPropertyChanged(() => ShockFlaskThreshold);
                }
            }

            /// <summary>Get / Set Enable Burning Flask</summary>
            [DefaultValue(false)]
            public bool UseBurningFlask
            {
                get { return _useBurningFlask; }
                set
                {
                    _useBurningFlask = value;
                    NotifyPropertyChanged(() => UseBurningFlask);
                }
            }

            /// <summary>Get / Set Burning Flask Threshold</summary>
            [DefaultValue(0)]
            public float BurningFlaskThreshold
            {
                get { return _burningFlaskThreshold; }
                set
                {
                    _burningFlaskThreshold = value;
                    NotifyPropertyChanged(() => BurningFlaskThreshold);
                }
            }

            /// <summary>Get / Set Enable Frozen Flask</summary>
            [DefaultValue(false)]
            public bool UseFrozenFlask
            {
                get { return _useFrozenFlask; }
                set
                {
                    _useFrozenFlask = value;
                    NotifyPropertyChanged(() => UseFrozenFlask);
                }
            }

            /// <summary>Get / Set Frozen Flask Threshold</summary>
            [DefaultValue(0)]
            public float FrozenFlaskThreshold
            {
                get { return _frozenFlaskThreshold; }
                set
                {
                    _frozenFlaskThreshold = value;
                    NotifyPropertyChanged(() => FrozenFlaskThreshold);
                }
            }

            /// <summary>Get / Set Enable Divination Flask</summary>
            [DefaultValue(false)]
            public bool UseDivinationFlask
            {
                get { return _useDivinationFlask; }
                set
                {
                    _useDivinationFlask = value;
                    NotifyPropertyChanged(() => UseDivinationFlask);
                }
            }

            /// <summary>Get / Set Granite Flask Threshold</summary>
            [DefaultValue(0)]
            public float DivinationFlaskThreshold
            {
                get { return _divinationFlaskThreshold; }
                set
                {
                    _divinationFlaskThreshold = value;
                    NotifyPropertyChanged(() => DivinationFlaskThreshold);
                }
            }

            /// <summary>Get / Set Enable Divination Flask</summary>
            [DefaultValue(false)]
            public bool UseEnergyShieldThresholds
            {
                get { return _useEnergyShieldForThresholds; }
                set
                {
                    _useEnergyShieldForThresholds = value;
                    NotifyPropertyChanged(() => UseEnergyShieldThresholds);
                }
            }

            #endregion

        #endregion

    }
}
